﻿namespace DesktopRibbon.IconCache
{
    using System;
    using System.Windows.Media;

    /// <summary>
    /// IconLoadedEventArgs is used by the IconCache.IconLoaded event.
    /// </summary>
    public class IconLoadedEventArgs : EventArgs
    {
        #region Fields

        private string path;
        private ImageSource smallIcon;
        private ImageSource largeIcon;
        private bool isImageFile;
        private object userData;

        #endregion

        #region Constructors

        /// <summary>
        /// Call this constructor to initialize this event arguments with the path and the small and large icons.
        /// <see cref="IconCache.LoadIcon"/>
        /// </summary>
        /// <param name="path"></param>
        /// <param name="smallIcon"></param>
        /// <param name="largeIcon"></param>
        /// <param name="userData"></param>
        /// <param name="isImageFile"></param>
        public IconLoadedEventArgs(
            string path,
            object userData,
            ImageSource smallIcon,
            ImageSource largeIcon,
            bool isImageFile)
        {
            this.path = path;
            this.smallIcon = smallIcon;
            this.largeIcon = largeIcon;
            this.userData = userData;
            this.isImageFile = isImageFile;
        }

        #endregion

        #region Properties

        /// <summary>
        /// UserData is a user-provided object that can be used to identify the loaded icon's target.
        /// </summary>
        public object UserData
        {
            get
            {
                return userData;
            }
        }

        /// <summary>
        /// The path that the icon has been loaded for.
        /// </summary>
        public string Path
        {
            get
            {
                return path;
            }
        }

        /// <summary>
        /// The small loaded icon.
        /// </summary>
        public ImageSource SmallIcon
        {
            get
            {
                return smallIcon;
            }
        }

        /// <summary>
        /// The small loaded icon.
        /// </summary>
        public ImageSource LargeIcon
        {
            get
            {
                return largeIcon;
            }
        }

        /// <summary>
        /// IsImageFile is true when the small icon or large icon has directly been loaded from Path 
        /// (this does not include DLL and EXE icons, only image files).
        /// </summary>
        public bool IsImageFile
        {
            get
            {
                return isImageFile;
            }
        }

        #endregion
    }
}
